#include "include/asm.h"
#include "include/debug.h"
#include "include/malta.h"

//[VW] had to uncomment this, because it was not yet syntactically right
//#include "include/process_management.h"


static char helloWorldString[100] = "PORN-OS running.";
static char x = 120;

/*
the following code to print on tty is copied from /example_files/debug.c
*/

void putc(char c)
{
  // BUSY wait for transmitter ready
  while (!tty->lsr.field.thre) {}

  // Transmit character
  tty->thr = c;
}

void print(const char* text)
{
  while (text[0] != '\0')
  {
    putc(text[0]);
    if (text[0] == '\n') 
      putc('\r');
    ++text;
  }
}

void println(const char* text)
{
  print(text);
  putc('\n');
  putc('\r');
}


/* This function is the entry point of our operating system.
   It initializes the differents datastructure the kernel will use.
*/
void pornos(void) {
  //initializeProcessesTable();
  
  kdebug_putc(x);
  kdebug_putc(x);
  kdebug_putc(x);


  helloWorldString[16] = 0;
  
  println(helloWorldString);

  while(1); //prevents the kernel from terminate
}
